<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="css/common.css" />
    <link rel="stylesheet" href="css/other.css" />
    <script src="js/axios.min.js"></script>
    

</head>

<body>
    <!-- 头部 -->
    <div id="login_header">
        <div class="login_log">
            <a href="" class="login_link"></a>
        </div>
        <div class=" login_img">
            <a href="" class="login_link1"></a>
            <a href="" class="login_link2"></a>
            <a href="" class="login_link3"></a>
        </div>
    </div>
    <!-- 内容区域 -->
    <div id="login_contain_wrap">
        <div class="zc_contain_img"></div>
        <div class="login_contain_box">
            <div class="login_contain_title">
                <h1><strong>用户注册</strong></h1>
                <div class="login_contain_title_one">
                    已有账号
                    <a href="login.html">在此登录</a>
                </div>
            </div>

            <form action="" id="login_contain_form">
                <div class="zc_contain_user">
                    <input type="text" placeholder="手机号" id="dynamic_mobile" value="">
                    <div class="focus_text">请输入11位手机号码</div>
                </div>
                <div class="zc_contain_passward">
                    <div class="login_contain_pass_left">
                        <input type="text" placeholder="短信校验码" id="dynamic_dx" autocomplete="off"> -->
                    </div>
                   <div class="login_contain_pass_right">
                        <a href="javascript:;" id="getPhoneCode" class="phonecode">
                            <strong>获取短信校验码</strong></a>
                    </div>
                </div>

                <div class="zc_contain_user">
                    <input type="password" placeholder="密码" id="dynamic_mobile"  value="">
                    <div class="focus_text">请输入11位手机号码</div>
                </div>

                <div class="zc_contain_user">
                    <input type="text" placeholder="重复密码" id="dynamic_mobile"value="">
                    <div class="focus_text">两次密码不一致,请重新输入</div>
                </div>
                <input  type="button" value="同意协议并注册" style=" display: block;width: 100%;">

            </form>
        </div>
       
        <script>
           
            let ipts = document.querySelectorAll('input');
            ipts[4].onclick = function () {
                let username = ipts[0].value
                let password = ipts[2].value
    
                let regAPI = 'http://jx.xuzhixiang.top/ap/api/reg.php'
    
                axios.get(regAPI, {
                    params: {
                        username,
                        password
                    }
                }).then(function (res) {
                    // 请求成
                    // console.log(res);
                    // console.log(res.data);//真正的数据
    
               alert(res.data.msg)
    
                    if (res.data.code == 1) {
                        location.href = 'login.html'
                    }
                }).catch(function (err) {
                    
                    console.log(err);
                })
    
    
            }
    
        </script>







</body>

</html>